// @Date         2021-11-17
// @Author       Aaron Zhang
// @Description
// @FileName      text.go

package formatter

import (
	"fmt"
	"zin/framework/contract"
	"zin/framework/util"
	"time"
)
// TextFormatter 文本 格式化
func TextFormatter(level contract.LogLevel, t time.Time, msg string, fields map[string]interface{}) ([]byte, error) {
	timeStr := util.ConvertDate2String(t.Unix(), util.DateFormat1)
	data := fmt.Sprintf("level:%s time:%s msg:%s fields:%v", getLevelPrefix(level), timeStr, msg, fields)

	return []byte(data), nil
}
